from rest_framework import serializers
from app01.models import Sensor,Project,Data,Drawing

# Sensor 序列化类
class SensorSerializer(serializers.ModelSerializer):
  class Meta:
    model = Sensor
    fields = "__all__"

# Project 序列化类
class ProjectSerializer(serializers.ModelSerializer):
  sensor = SensorSerializer()
  class Meta:
    model = Project
    fields = "__all__"

# Data 序列化类
class DataSerializer(serializers.ModelSerializer):
  project = ProjectSerializer()
  class Meta:
    model = Data
    fields = "__all__"

# Drawing 序列化类
class DrawingSerializer(serializers.ModelSerializer):
  data = DataSerializer()
  class Meta:
    model = Drawing
    fields = "__all__"